<?php
 header("content-type:text/html;charset=utf-8");

class mysqlPdo
{
    public static function getPdoConnect()
    {
      $mysql_conf = array(
        'host'    => 'localhost', 
        'db'      => 'boke', 
        'db_user' => 'root', 
        'db_pwd'  => 'root', 
        );

      try{
        $pdo = new PDO("mysql:host=".$mysql_conf['host'].";dbname=".$mysql_conf['db'],$mysql_conf['db_user'],$mysql_conf['db_pwd']);          
      } catch(PDOException $e) {
        echo "数据库连接失败:".$e->getMessage();
        exit;
      }

      return $pdo;
    }
}
  

    $mysql_conf = array(
        'host'    => 'localhost', 
        'db'      => 'boke', 
        'db_user' => 'root', 
        'db_pwd'  => 'root', 
        );

      try{
        $pdo = new PDO("mysql:host=".$mysql_conf['host'].";dbname=".$mysql_conf['db'],$mysql_conf['db_user'],$mysql_conf['db_pwd']);          
      } catch(PDOException $e) {
        echo "数据库连接失败:".$e->getMessage();
        exit;
      }